home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / CTBUtilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  6.0 KB  |  224 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        CTBUtilities.h
  3.  
  4.      Contains:    Communications Toolbox Utilities interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1988-1993, 1995-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __CTBUTILITIES__
  19. #define __CTBUTILITIES__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24. #ifndef __MACTYPES__
  25. #include <MacTypes.h>
  26. #endif
  27. #ifndef __MIXEDMODE__
  28. #include <MixedMode.h>
  29. #endif
  30. #ifndef __DIALOGS__
  31. #include <Dialogs.h>
  32. #endif
  33. #ifndef __APPLETALK__
  34. #include <AppleTalk.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59.  
  60. enum {
  61.     curCTBUVersion                = 2                                /* version of Comm Toolbox Utilities*/
  62. };
  63.  
  64.  
  65. enum {
  66.                                                                 /*    Error codes/types    */
  67.     ctbuGenericError            = -1,
  68.     ctbuNoErr                    = 0
  69. };
  70.  
  71. typedef OSErr                             CTBUErr;
  72.  
  73. enum {
  74.     chooseDisaster                = -2,
  75.     chooseFailed                = -1,
  76.     chooseAborted                = 0,
  77.     chooseOKMinor                = 1,
  78.     chooseOKMajor                = 2,
  79.     chooseCancel                = 3
  80. };
  81.  
  82. typedef unsigned short                     ChooseReturnCode;
  83.  
  84. enum {
  85.     nlOk                        = 0,
  86.     nlCancel                    = 1,
  87.     nlEject                        = 2
  88. };
  89.  
  90. typedef unsigned short                     NuLookupReturnCode;
  91.  
  92. enum {
  93.     nameInclude                    = 1,
  94.     nameDisable                    = 2,
  95.     nameReject                    = 3
  96. };
  97.  
  98. typedef unsigned short                     NameFilterReturnCode;
  99.  
  100. enum {
  101.     zoneInclude                    = 1,
  102.     zoneDisable                    = 2,
  103.     zoneReject                    = 3
  104. };
  105.  
  106. typedef unsigned short                     ZoneFilterReturnCode;
  107.  
  108. enum {
  109.                                                                 /*    Values for hookProc items        */
  110.     hookOK                        = 1,
  111.     hookCancel                    = 2,
  112.     hookOutline                    = 3,
  113.     hookTitle                    = 4,
  114.     hookItemList                = 5,
  115.     hookZoneTitle                = 6,
  116.     hookZoneList                = 7,
  117.     hookLine                    = 8,
  118.     hookVersion                    = 9,
  119.     hookReserved1                = 10,
  120.     hookReserved2                = 11,
  121.     hookReserved3                = 12,
  122.     hookReserved4                = 13,                            /*    "virtual" hookProc items    */
  123.     hookNull                    = 100,
  124.     hookItemRefresh                = 101,
  125.     hookZoneRefresh                = 102,
  126.     hookEject                    = 103,
  127.     hookPreflight                = 104,
  128.     hookPostflight                = 105,
  129.     hookKeyBase                    = 1000
  130. };
  131.  
  132.  
  133. /*    NuLookup structures/constants    */
  134.  
  135. struct NLTypeEntry {
  136.     Handle                             hIcon;
  137.     Str32                             typeStr;
  138. };
  139. typedef struct NLTypeEntry                NLTypeEntry;
  140.  
  141. typedef NLTypeEntry                     NLType[4];
  142.  
  143. struct NBPReply {
  144.     EntityName                         theEntity;
  145.     AddrBlock                         theAddr;
  146. };
  147. typedef struct NBPReply                    NBPReply;
  148. typedef CALLBACK_API( short , DialogHookProcPtr )(short item, DialogPtr theDialog);
  149. typedef CALLBACK_API( short , NameFilterProcPtr )(const EntityName *theEntity)/*  (22) added const */;
  150. typedef CALLBACK_API( short , ZoneFilterProcPtr )(ConstStr32Param theZone);
  151. typedef STACK_UPP_TYPE(DialogHookProcPtr)                         DialogHookUPP;
  152. typedef STACK_UPP_TYPE(NameFilterProcPtr)                         NameFilterUPP;
  153. typedef STACK_UPP_TYPE(ZoneFilterProcPtr)                         ZoneFilterUPP;
  154. enum { uppDialogHookProcInfo = 0x000003A0 };                     /* pascal 2_bytes Func(2_bytes, 4_bytes) */
  155. enum { uppNameFilterProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  156. enum { uppZoneFilterProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  157. #define NewDialogHookProc(userRoutine)                             (DialogHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
  158. #define NewNameFilterProc(userRoutine)                             (NameFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
  159. #define NewZoneFilterProc(userRoutine)                             (ZoneFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
  160. #define CallDialogHookProc(userRoutine, item, theDialog)         CALL_TWO_PARAMETER_UPP((userRoutine), uppDialogHookProcInfo, (item), (theDialog))
  161. #define CallNameFilterProc(userRoutine, theEntity)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppNameFilterProcInfo, (theEntity))
  162. #define CallZoneFilterProc(userRoutine, theZone)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppZoneFilterProcInfo, (theZone))
  163. EXTERN_API( CTBUErr )
  164. InitCTBUtilities                (void);
  165.  
  166. EXTERN_API( short )
  167. CTBGetCTBVersion                (void);
  168.  
  169. EXTERN_API( short )
  170. StandardNBP                        (Point                     where,
  171.                                  ConstStr255Param         prompt,
  172.                                  short                     numTypes,
  173.                                  NLType                 typeList,
  174.                                  NameFilterUPP             nameFilter,
  175.                                  ZoneFilterUPP             zoneFilter,
  176.                                  DialogHookUPP             hook,
  177.                                  NBPReply *                theReply);
  178.  
  179. EXTERN_API( short )
  180. CustomNBP                        (Point                     where,
  181.                                  ConstStr255Param         prompt,
  182.                                  short                     numTypes,
  183.                                  NLType                 typeList,
  184.                                  NameFilterUPP             nameFilter,
  185.                                  ZoneFilterUPP             zoneFilter,
  186.                                  DialogHookUPP             hook,
  187.                                  long                     userData,
  188.                                  short                     dialogID,
  189.                                  ModalFilterUPP         filter,
  190.                                  NBPReply *                theReply);
  191.  
  192. #if OLDROUTINENAMES
  193. #define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter,    \
  194. hook, theReply)                                                                \
  195. StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter,         \
  196. hook, theReply)
  197. #define NuPLookup(where, prompt, numTypes, typeList, nameFilter,                 \
  198. zoneFilter, hook, userData, dialogID, filter, theReply)                        \
  199. CustomNBP(where, prompt, numTypes, typeList, nameFilter,                         \
  200. zoneFilter, hook, userData, dialogID, filter, theReply)
  201. #endif  /* OLDROUTINENAMES */
  202.  
  203.  
  204. #if PRAGMA_STRUCT_ALIGN
  205.     #pragma options align=reset
  206. #elif PRAGMA_STRUCT_PACKPUSH
  207.     #pragma pack(pop)
  208. #elif PRAGMA_STRUCT_PACK
  209.     #pragma pack()
  210. #endif
  211.  
  212. #ifdef PRAGMA_IMPORT_OFF
  213. #pragma import off
  214. #elif PRAGMA_IMPORT
  215. #pragma import reset
  216. #endif
  217.  
  218. #ifdef __cplusplus
  219. }
  220. #endif
  221.  
  222. #endif /* __CTBUTILITIES__ */
  223.  
  224.